﻿<phone:PhoneApplicationPage 
    x:Class="SMSHelper.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

  <!--LayoutRoot is the root grid where all page content is placed-->
  <Border >
    <Border.Background>
      <ImageBrush ImageSource="back.png" />
    </Border.Background>
    <Grid x:Name="LayoutRoot"  Background="#66000000" Margin="0,0,0,0">

      <Grid.Resources>
        <SolidColorBrush Color="Honeydew" x:Key="fontBrush"  />
        <Style TargetType="CheckBox" x:Key="chkForName">
          <Setter Property="Foreground" Value="{StaticResource fontBrush}" />
          <Setter Property="FontSize" Value="28" />
          <Setter Property="BorderBrush" Value="Green" />
          <Setter Property="BorderThickness" Value="1" />
          <Setter Property="FontWeight" Value="Bold"/>
        </Style>
        <Style TargetType="TextBlock" x:Key="tbForNumber">
          <Setter Property="Margin" Value="0,0,0,-12" />
          <Setter Property="FontSize" Value="22" />
          <Setter Property="Foreground" Value="DarkKhaki" />
          <Setter Property="FontWeight" Value="Bold" />
          <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
      </Grid.Resources>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
      </Grid.RowDefinitions>

      <!--TitlePanel contains the name of the application and page title-->
      <TextBlock x:Name="PageTitle" 
                       Text="{Binding Path=LocalizedResources.PageTitle,Source={StaticResource LocalizedStrings}}"
                       Grid.Row="0"
                       Margin="10,10,0,10" 
                       Foreground="DarkGreen"
                       FontWeight="Bold"
                       FontSize="38" 
                       Style="{StaticResource PhoneTextTitle1Style}"/>

      <!--ContentPanel - place additional content here-->
      <Grid x:Name="ContentPanel" 
              Grid.Row="1" 
              Margin="12,0,12,0" >

        <StackPanel VerticalAlignment="Center" x:Name="spLoding">
          <TextBlock     Text="{Binding Path=LocalizedResources.Loading,Source={StaticResource LocalizedStrings}}"
                            HorizontalAlignment="Center" 
                            Foreground="DarkGreen" 
                            FontWeight="Bold"/>
          <ProgressBar IsIndeterminate="True" Margin="0,10,0,5" Foreground="{StaticResource fontBrush}"/>
        </StackPanel>

        <toolkit:LongListSelector  x:Name="longList"
                                      ItemsSource="{Binding}">
          <toolkit:LongListSelector.GroupHeaderTemplate>
            <DataTemplate>
              <Border 
                                BorderBrush="DarkGreen" 
                                BorderThickness="2" 
                                Padding="5,10,33,0"  
                                Background="Transparent"
                                HorizontalAlignment="Left">
                <TextBlock Text="{Binding Title}" 
                                           FontWeight="Bold"
                                           Foreground="Green"  
                                           FontSize="40"  />
              </Border>
            </DataTemplate>
          </toolkit:LongListSelector.GroupHeaderTemplate>
          <toolkit:LongListSelector.GroupItemTemplate>
            <DataTemplate>
              <Border Background="Green" 
                                Margin="10"
                                BorderThickness="1" 
                                Width="85"
                                Height="90"
                                >
                <TextBlock Text="{Binding Title}"  
                                       Foreground="White"  
                                       HorizontalAlignment="Left"
                                       VerticalAlignment="Bottom"
                                       Margin="5,30,0,0"
                                       TextAlignment="Left"
                                       FontSize="48" />
              </Border>
            </DataTemplate>
          </toolkit:LongListSelector.GroupItemTemplate>
          <toolkit:LongListSelector.GroupItemsPanel>
            <ItemsPanelTemplate>
              <toolkit:WrapPanel  Orientation="Horizontal" Margin="5"/>
            </ItemsPanelTemplate>
          </toolkit:LongListSelector.GroupItemsPanel>
          <toolkit:LongListSelector.ItemTemplate>
            <DataTemplate>
              <Grid  >
                <CheckBox    
                                Margin="0,-15,0,0"
                                ManipulationStarted="chk_ManipulationStarted"
                                ManipulationCompleted="chk_ManipulationCompleted"
                                IsChecked="{Binding IsChecked,Mode=TwoWay}"
                                Style="{StaticResource chkForName}" >
                  <CheckBox.RenderTransform>
                    <TranslateTransform X="0" Y="0" />
                  </CheckBox.RenderTransform>
                  <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding PersonName}"  Margin="2,0,3,0"/>
                    <TextBlock Text="{Binding PhoneNumber}" 
                                       Style="{StaticResource tbForNumber}" />
                  </StackPanel>
                </CheckBox>
              </Grid>
            </DataTemplate>
          </toolkit:LongListSelector.ItemTemplate>
        </toolkit:LongListSelector>

        <Grid.Clip>
          <RectangleGeometry Rect="0,0,480,620"  />
        </Grid.Clip>
        <Grid.OpacityMask>
          <LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
            <LinearGradientBrush.GradientStops>
              <GradientStop Offset="0.0" Color="#00000000" />
              <GradientStop Offset="0.08" Color="#FF000000" />
              <GradientStop Offset="0.92" Color="#FF000000" />
              <GradientStop Offset="1" Color="#00000000" />
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Grid.OpacityMask>
      </Grid>
    </Grid>

  </Border>

  <!--Sample code showing usage of ApplicationBar-->
  <phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" BackgroundColor="DarkCyan" Mode="Default" Opacity="0.7"   IsMenuEnabled="True">
      <shell:ApplicationBarIconButton IconUri="Icon/next.png" x:Name="btnGoNext"  Click="btnGoNext_Click" Text="SendMsg"/>
      <shell:ApplicationBarIconButton IconUri="Icon/cancel.png" x:Name="btnCancel" Click="btnCancel_Click" Text="ClearAll"/>
      <shell:ApplicationBar.MenuItems>
        <shell:ApplicationBarMenuItem Text="UpdateContacts" x:Name="miUpdateNumber" Click="miUpdateNumber_Click"/>
        <shell:ApplicationBarMenuItem Text="Help" x:Name="miHelp" Click="miHelp_Click" />
      </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
  </phone:PhoneApplicationPage.ApplicationBar>
  <!--<shell:ApplicationBarMenuItem Text="删除本地库" x:Name="miDeleteAll" Click="miDeleteAll_Click"/>-->
</phone:PhoneApplicationPage>